<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    use HasFactory;

    protected $table = 'users';

    //不可注入的数据字段
    protected $guarded = [

    ];

    //保存数据记录
    public function saveData($searchKey,$searchVal,$data){
        return $this->updateOrcreate([$searchKey => $searchVal],$data);
    }

    public function getInfo($field, $val){
        return $this->where($field,'=',$val)->first();
    }


}
